using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

//Importamos
using EventSys.BussinesEntities;

namespace EventSys.Repository.Mapping
{
    public class InversionMap : EntityTypeConfiguration<Inversion>
    {
        public InversionMap()
        {
            // Primary Key
            this.HasKey(t => t.idInversion);

            // Properties
            this.Property(t => t.TipoAsistente)
                .IsFixedLength()
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("Inversion");
            this.Property(t => t.idInversion).HasColumnName("idInversion");
            this.Property(t => t.IdEvents).HasColumnName("IdEvents");
            this.Property(t => t.IdActividad).HasColumnName("IdActividad");
            this.Property(t => t.TipoAsistente).HasColumnName("TipoAsistente");
            this.Property(t => t.Monto).HasColumnName("Monto");

            // Relationships
            this.HasOptional(t => t.Actividad)
                .WithMany(t => t.Inversions)
                .HasForeignKey(d => d.IdActividad);
            this.HasOptional(t => t.Evento)
                .WithMany(t => t.Inversions)
                .HasForeignKey(d => d.IdEvents);

        }
    }
}
